package com.example.reggie.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.example.reggie.entity.User;
import com.example.reggie.service.UserService;
import com.example.reggie.utils.R;
import com.example.reggie.utils.ValidateCodeUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;
import java.util.Map;

@RestController
@RequestMapping("/user")
@Slf4j
public class UserController {
    @Resource
    private StringRedisTemplate stringRedisTemplate;

    @Autowired
    private UserService userService;
    @PostMapping("/sendMsg")
    public R sendMsg(@RequestBody User user){
        userService.sendMsg(user.getPhone());
        return R.success("发送成功");
    }

    @PostMapping("/login")
    public R login(@RequestBody Map map,HttpSession session){
        return userService.login(map,session);
    }
}
